// ChartEventSink.cpp : implementation file
//

#include "stdafx.h"
#include "SpeedOrder.h"
#include "ChartEventSink.h"

#include "MainOrderPanel.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CChartEventSink

IMPLEMENT_DYNCREATE(CChartEventSink, CCmdTarget)

CChartEventSink::CChartEventSink()
{
	EnableAutomation();
}

CChartEventSink::~CChartEventSink()
{
}


void CChartEventSink::OnFinalRelease()
{
	// When the last reference for an automation object is released
	// OnFinalRelease is called.  The base class will automatically
	// deletes the object.  Add additional cleanup required for your
	// object before calling the base class.

	CCmdTarget::OnFinalRelease();
}


BEGIN_MESSAGE_MAP(CChartEventSink, CCmdTarget)
	//{{AFX_MSG_MAP(CChartEventSink)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CChartEventSink, CCmdTarget)
	//{{AFX_DISPATCH_MAP(CChartEventSink)
	DISP_FUNCTION(CChartEventSink, "OnDataRefreshed", OnDataRefreshed, VT_EMPTY, VTS_DISPATCH)
	DISP_FUNCTION(CChartEventSink, "OnDataAdded", OnDataAdded, VT_EMPTY, VTS_DISPATCH)
	DISP_FUNCTION(CChartEventSink, "OnDataUpdated", OnDataUpdated, VT_EMPTY, VTS_DISPATCH)
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IChartEventSink to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.




BEGIN_INTERFACE_MAP(CChartEventSink, CCmdTarget)
	INTERFACE_PART(CChartEventSink, IID_IGxChartDataEvents, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChartEventSink message handlers

void CChartEventSink::OnDataRefreshed(LPDISPATCH ChartData) 
{
	// TODO: Add your dispatch handler code here

	if (m_pMainDlg == NULL) return;

	//m_pMainDlg->RefreshData(ChartData);

	

}

void CChartEventSink::OnDataAdded(LPDISPATCH ChartData) 
{
	// TODO: Add your dispatch handler code here

	if (m_pMainDlg == NULL) return;

	//m_pMainDlg->AddData(ChartData);

}

void CChartEventSink::OnDataUpdated(LPDISPATCH ChartData) 
{
	// TODO: Add your dispatch handler code here

	if (m_pMainDlg == NULL) return;

	//m_pMainDlg->UpdateLastData(ChartData);


}
